
GO

/****** Object:  Table [dbo].[ResTable]    Script Date: 12/11/2011 10:05:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[ResTable](
	[TableId] [bigint] IDENTITY(1,1) NOT NULL,
	[AreaId] [bigint] NOT NULL,
	[TableCode] [nvarchar](50) NOT NULL,
	[TableName] [nvarchar](50) NOT NULL,
	[StatusId] [int] NOT NULL,
	[Note] [nvarchar](255) NOT NULL,
	[TimeStamp] [timestamp] NOT NULL,
 CONSTRAINT [PK_ResTable] PRIMARY KEY CLUSTERED 
(
	[TableId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[ResTable]  WITH CHECK ADD  CONSTRAINT [FK_ResTable_ResArea] FOREIGN KEY([AreaId])
REFERENCES [dbo].[ResArea] ([AreaId])
GO

ALTER TABLE [dbo].[ResTable] CHECK CONSTRAINT [FK_ResTable_ResArea]
GO

ALTER TABLE [dbo].[ResTable]  WITH NOCHECK ADD  CONSTRAINT [FK_ResTable_StatusTable] FOREIGN KEY([StatusId])
REFERENCES [dbo].[StatusTable] ([StatusId])
GO

ALTER TABLE [dbo].[ResTable] CHECK CONSTRAINT [FK_ResTable_StatusTable]
GO


